package com.carsystem.controller;


import com.carsystem.entity.Car;
import com.carsystem.entity.TReturncar;
import com.carsystem.request.OrderRequestVo;
import com.carsystem.request.ReturnCarRequestVo;
import com.carsystem.response.OrderResponseVo;
import com.carsystem.response.ReturnCarResponseVo;
import com.carsystem.service.ITReturncarService;
import com.carsystem.utils.BaseController;
import com.carsystem.utils.PageHandler;
import com.carsystem.utils.Result;
import com.carsystem.utils.ResultEntity;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ykl
 * @since 2022-03-25
 */
@RestController
@RequestMapping("/tReturncar")
public class TReturncarController extends BaseController {

    @Reference
    private ITReturncarService returncarService;

    /**
     * 还车管理分页查询
     * @param returnCarRequestVo
     * @return
     */
    @RequestMapping("/selectPage")
    public ResultEntity<ReturnCarResponseVo> selectOrderByPage(@RequestBody ReturnCarRequestVo returnCarRequestVo){
        Map<String, Object> returnMap = new HashMap<>();
        PageHandler pageHandler = returncarService.selectReturnByPage(returnCarRequestVo);
        returnMap.put("page",pageHandler);
        return getSuccessEntity(returnMap);
    }

    /**
     * 还车上传磨损图片
     * @param returncar
     * @return
     */
    @RequestMapping("/returnUpload")
    public Result addCar(@RequestBody TReturncar returncar){
        return returncarService.returnUpload(returncar);
    }

}
